﻿Module Communication
    Private CurSecond As Integer
    Public CurOOCMessage As Integer
    Public CurSendMessage As String
    Public Sub Tick()
        CurSecond += 1
        If CurSecond >= 40 Then
            'now show all the messages you missed excluding your own messages
            Try
                If MainProgram.BackgroundGetcommunications.IsBusy = False Then MainProgram.BackgroundGetcommunications.RunWorkerAsync()
                CurSecond = 0
            Catch errorvariable As Exception 'just incase file is corrupt or missing
                'MainProgram.SND("/RERROR: " + errorvariable.ToString())
                CurSecond = 0
            End Try
        End If
    End Sub
    Public Sub CMD_say(ByVal casesensitive As String, ByVal txt As String, ByVal cmdlen As Short, ByVal nputlen As Short)
        Dim talk = LTrim(RTrim(Mid(casesensitive, 4, casesensitive.Length)))
        MainProgram.SND("/wYou - /G" + Chr(34) + "/g" + talk + "/G" + Chr(34))
    End Sub
    Public Sub CMD_osay(ByVal casesensitive As String, ByVal txt As String, ByVal cmdlen As Short, ByVal nputlen As Short)
        Dim talk = LTrim(RTrim(Mid(casesensitive, 5, casesensitive.Length)))
        MainProgram.SND("/g(/GOsay/g) /wYou - /G" + Chr(34) + "/g" + talk + "/G" + Chr(34))
    End Sub
    Public Sub CMD_ooc(ByVal casesensitive As String, ByVal txt As String, ByVal cmdlen As Short, ByVal nputlen As Short)
        Dim talk = LTrim(RTrim(Mid(casesensitive, 4, casesensitive.Length)))
        MainProgram.SND("/g(/GOOC/g) /wYou - /G" + Chr(34) + "/g" + talk + "/G" + Chr(34))
        Try
            If MainProgram.BackgroundSendcommunications.IsBusy = False Then
                CurSendMessage = talk
                MainProgram.BackgroundSendcommunications.RunWorkerAsync()
            Else
                MainProgram.SND("/rYour message was not sent.")
            End If
        Catch errorvariable As Exception 'just incase file is corrupt or missing
            'MainProgram.SND("/RERROR: " + errorvariable.ToString())
        End Try
    End Sub
    Public Sub CMD_ic(ByVal casesensitive As String, ByVal txt As String, ByVal cmdlen As Short, ByVal nputlen As Short)
        Dim talk = LTrim(RTrim(Mid(casesensitive, 3, casesensitive.Length)))
        MainProgram.SND("/W(/GIC/W) /wYou - /G" + Chr(34) + "/g" + talk + "/G" + Chr(34))
    End Sub
End Module
